﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbstractMq
{
    /// <summary>
    /// 发布者
    /// </summary>
    public interface IPublisher
    {
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="channelName"></param>
        /// <param name="message"></param>
        void Publish<T>(string channelName, T message) where T : class;
        /// <summary>
        /// 异步发布
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="channelName">主题名</param>
        /// <param name="message">发送的消息</param>
        Task PublishAsync<T>(string channelName, T message) where T : class;
        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="exchangeName"></param>
        /// <param name="queueName"></param>
        /// <param name="routingKey"></param>
        /// <param name="messgae"></param>
        void Publish<T>(string exchangeName, string queueName, string routingKey, T messgae) where T : class;
        /// <summary>
        /// 异步rabbitmq使用发布
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="exchangeName">交换机</param>
        /// <param name="queueName">队列名称</param>
        /// <param name="routingKey">路由</param>
        /// <param name="messgae">消息</param>
        /// <returns></returns>
        Task PublishAsync<T>(string exchangeName, string queueName, string routingKey, T messgae) where T : class;
    }
}
